Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fallback extension configurable #232

Merged
merged 5 commits into from
Jul 13, 2023
Merged

Make fallback extension configurable #232

merged 5 commits into from
Jul 13, 2023

Conversation

rustamwin
Copy link
Member

Q A
Is bugfix? ✔️
New feature? ✔️
Breaks BC?
Fixed issues #227

@rustamwin rustamwin added the status:code review The pull request needs review. label Jul 12, 2023
@rustamwin rustamwin requested a review from a team July 12, 2023 08:25
@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (d211ca6) 99.74% compared to head (c6a0271) 99.74%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #232   +/-   ##
=========================================
  Coverage     99.74%   99.74%           
- Complexity      299      300    +1     
=========================================
  Files            18       18           
  Lines           791      792    +1     
=========================================
+ Hits            789      790    +1     
  Misses            2        2           
Impacted Files Coverage Δ
src/ViewTrait.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rustamwin rustamwin linked an issue Jul 12, 2023 that may be closed by this pull request
@what-the-diff
Copy link

what-the-diff bot commented Jul 12, 2023

PR Summary

  • Introduction of constant variable for PHP extension
    For more consistent code, a constant PHP_EXTENSION has been introduced. This adjustment makes our code more resilient against minor changes and less prone to errors.

  • Use of new constant in place initialization
    The property $defaultExtension within ViewTrait has been modified to use the new constant PHP_EXTENSION, replacing the previous static string, 'php'. This change is consistent with the introduction of the new constant. In addition, a new attribute $fallbackExtension has been introduced with a default value of PHP_EXTENSION.

  • Addition of backup solution
    A new method withFallbackExtension was added to the ViewTrait trait. If the selected extension is not available, this method provides an automatic alternative, improving reliability.

  • Modifying find methods to adapt to fallback strategy
    The findTemplateFile method in ViewTrait has been altered to use the $fallbackExtension value rather than the static '.php'. This harmonizes with the above highlights, providing a more flexible and adjustable solution.

  • Tests covering new fallback mechanism
    For verification of newly added functionalities, a new test case testRenderWithoutFileExtension has been added in the ViewTest class. The test uses the withDefaultExtension and withFallbackExtension methods, ensuring that the changes work as intended and improving overall robustness of the software.

Copy link
Member

@samdark samdark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a line for CHANGELOG.

tests/ViewTest.php Outdated Show resolved Hide resolved
@samdark samdark merged commit 0086712 into master Jul 13, 2023
25 of 27 checks passed
@samdark
Copy link
Member

samdark commented Jul 13, 2023

👍

@samdark samdark deleted the fix-227 branch July 13, 2023 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use incorrect template with default extension
4 participants